<?php
/**
 * VIP会员API控制器
 * @author 王勇程 <laughskydragon@qq.com>
 */

namespace app\api\controller;

use app\api\controller\ApiBase;

class Vip extends ApiBase
{

    
    /**
     * 获取VIP套餐列表
     */
    public function getVipPackages()
    {
        $result = $this->logicVip->getVipPackages();
        return $this->apiReturn($result);
    }
    

    
    /**
     * 获取用户VIP信息
     */
    public function getUserVipInfo()
    {
        $data = $this->request->param();
        $result = $this->logicVip->getUserVipInfo($data);
        return $this->apiReturn($result);
    }
    

    
    /**
     * 创建VIP订单
     */
    public function createVipOrder()
    {
        $data = $this->request->param();
        $result = $this->logicVip->createVipOrder($data);
        return $this->apiReturn($result);
    }
    

    
    /**
     * 支付成功回调
     */
    public function paymentSuccess()
    {
        $data = $this->request->param();
        $result = $this->logicVip->paymentSuccess($data);
        return $this->apiReturn($result);
    }
    

    
    /**
     * 获取最近充值会员列表
     */
    public function getRecentVipUsers()
    {
        $data = $this->request->param();
        $result = $this->logicVip->getRecentVipUsers($data);
        return $this->apiReturn($result);
    }
    

    
    /**
     * 检查用户VIP状态
     */
    public function checkUserVip()
    {
        $data = $this->request->param();
        $result = $this->logicVip->checkUserVip($data);
        return $this->apiReturn($result);
    }
    

    
    /**
     * 获取用户VIP购买记录
     */
    public function getUserVipHistory()
    {
        $data = $this->request->param();
        $result = $this->logicVip->getUserVipHistory($data);
        return $this->apiReturn($result);
    }

    /**
     * 请求支付参数（微信）
     */
    public function requestPayment()
    {
        $data = $this->request->param();
        $result = $this->logicVip->requestPayment($data);
        return $this->apiReturn($result);
    }

    /**
     * 微信支付异步通知
     */
    public function wechatNotify()
    {
        $result = $this->logicVip->wechatNotify();
        return $this->apiReturn($result);
    }
}
